﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using QuickTasks.ViewModels.Properties;
using Microsoft.Advertising.Mobile.UI;


namespace QuickTasks.Views
{
    public partial class CompleteTaskDetail : PhoneApplicationPage
    {
        QuickTaskDataContext context = new QuickTaskDataContext(App.ConnectionString);
        int cnt = 0;
      
        public CompleteTaskDetail()
        {
            InitializeComponent();
          
        }
      
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            string listid = null;
            try
            {
                if (NavigationContext.QueryString.TryGetValue("listid", out listid))
                {

                    List<ToDoListProper> objToDoListProper = new List<ToDoListProper>();
                   

                        var listquery = from i in context.CTodo where i.id.ToString() ==listid select i;
                        foreach (var item in listquery)
                        {
                            tbxName.Text = item.name;
                            tblkDescription.Text = item.description;
                            tbxCatagiry.Text = item.category;
                            if (cnt == 0)
                            {
                                tblkdatepic.Text = System.DateTime.Now.ToShortDateString();
                                cnt++;
                            }
                            break;
                        }
                    }
                }
            
            catch (Exception ex)
            {
                Exceptions.SaveOrSendExceptions("Exception in PhoneApplicationPage_Loaded event In CompletedTaskDetail.xaml page", ex);
            }
        }
    }
}